<template>
  <p>姓名：{{ name }}</p>
  <p>年龄：{{ age }}</p>
  <button @click="info">用户信息</button>
</template>

<script>
export default {
  name: "SetupDemo",
  // 返回的对象才可以模板读取到内容
  setup() {

    const name = '小马奔腾'
    const age = 18

    const info = () => {
      alert(`name=${name},age=${age}`)
    }

    return {
      name,
      age,
      info
    }
  }
}
</script>

<style scoped>

</style>